<template>
	<view class="page-content">
		<view class="" v-if="list.length>0">
			<view class="box" v-for="(item,index) in list" :key="index" @click="detaile(item)" >
				<view :class="['img',item.status==0? 'news':'']" ><image :src="item.coverJson" mode=""></image></view>
				<view class="msg">
					<view class="time">
						<view class="title">{{item.title}}</view>
						<view class="day">{{item.createdAt}}</view>
					</view>
					<view class="content">{{item.content}}</view>
				</view>
			</view>
		</view>	
		<view class="" style="padding-top:180rpx;" v-else>
			<image src="../../../static/none/news.png" mode="" class="none"></image>
			<view class="noneTxt">暂无消息</view>
		</view>
		<!-- 返回顶部 -->
		<back-top :scrollTop='scrollTop'></back-top>
	</view>
</template>

<script>
	import backTop from '../../../components/uni-ui/back-top/back-top.vue';
	import { selectMessageList } from '@/apis/message/index.js' 
	export default {
		data() {
			return {
				scrollTop:0,
				list:'',
			}
		},
		onLoad(){
		},
		onShow() {
			this.getList()
		},
		onPageScroll(e) {
			this.scrollTop = e.scrollTop;
		},
		computed:{
			
		},
		components:{
			backTop,
		},
		methods: {
			async getList(){
				var res =await selectMessageList({messageType:1,nurseId:this.$store.state.userInfo.id})
				this.list = res.object
				console.log(this.list,'system')
			},
			detaile(item){
				console.log(item.id)
				uni.navigateTo({
					url:'../news-detaile/news-detaile?id='+item.id
				})
			}
		}
	}
</script>

<style scoped lang="less">
	.page-content{
		// box-sizing:border-box;
		background:#FAFAFB;
		min-height:100vh;
	}
	.box{
		height: 164rpx;
		background: #FFFFFF;
		display: flex;
		justify-content: center;
		padding-top: 32rpx;
		box-sizing: border-box;
		.img{
			width: 88rpx;
			height: 88rpx;
			border-radius: 20rpx;
			background: url(../../../static/img/news/systemMessage.png);
			background-size:cover;
			image{
				width: 88rpx;
				height: 88rpx;
				border-radius: 20rpx;
			}
		}
		.msg{
			width: 534rpx;
			margin-left: 24rpx;
			font-family: PingFangSC-Medium, PingFang SC;
			.time{
				width: 534rpx;
				height: 44rpx;
				display: flex;
				box-sizing: border-box;
				.title{
					height: 44rpx;
					width: 206rpx;
					font-size: 32rpx;
					font-weight: 500;
					color: #0E0E0E;
					display: inline-block;
					overflow:hidden;
					text-overflow:ellipsis;
					white-space:nowrap
				}
				.day{
					height: 44rpx;
					font-size: 28rpx;
					font-weight: 400;
					color: #8F8F8F;
					margin-left: 36rpx;
					line-height: 44rpx;
					display: inline-block;
				}
				.exact{
					height: 44rpx;
					font-size: 28rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #8F8F8F;
					margin-left: 16rpx;
					line-height: 44rpx;
					display: inline-block;
				}
			}
			.content{
				margin-top: 16rpx;
				width: 534rpx;
				max-height: 120rpx;
				font-size: 28rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #8F8F8F;
				line-height: 40rpx;
				overflow:hidden;
				text-overflow:ellipsis;
			}
		}
	}
	.none{
		width: 442rpx;
		height: 300rpx;
		display: block;
		margin: 0 auto;
	}
	.noneTxt{
		font-weight: 500;
		font-size: 36rpx;
		color: #3E3E3E;
		text-align:center;
		margin-top:80rpx;
	}
	.news {
		position: relative;
		&:after {
			content: '';
			position: absolute;
			right:0;
			top: 0;
			display: block;
			width: 10rpx;
			height: 10rpx;
			background-color: #ff4f4f;
			border-radius: 50%;
		}
	}
</style>
